#ifndef _NE_RENDERABLE_OBJECT_H_
#define _NE_RENDERABLE_OBJECT_H_

#include <common/Object.h>

namespace ne
{
    class RenderableObject : public Object
    {
        public:
            explicit RenderableObject(const std::string &name="RenderableObject")
                : Object(name),
                  mEnable(true),
                  mVisible(true),
                  mActive(true)
            {
            }

            RenderableObject(const RenderableObject &obj)
                : Object(obj),
                  mEnable(obj.mEnable),
                  mVisible(obj.mVisible),
                  mActive(obj.mActive)
            {
            }

            RenderableObject& operator = (const RenderableObject &obj)
            {
                Object::operator = (obj);
                mEnable = obj.mEnable;
                mVisible = obj.mVisible;
                mActive = obj.mActive;
                return *this;
            }

            virtual void setEnable(const bool b)
            {
                mEnable = b;
            }

            void enable()
            {
                setEnable(true);
            }

            void disable()
            {
                setEnable(false);
            }

            bool isEnable() const
            {
                return mEnable;
            }

            virtual void setVisible(const bool b)
            {
                // TODO: set enable before visible
                if (b)
                {
                    setEnable(true);
                }
                mVisible = b;
            }

            void show()
            {
                setVisible(true);
            }

            void hide()
            {
                setVisible(false);
            }

            bool isVisible() const
            {
                return (mVisible && isEnable());
            }

            virtual void setActive(const bool b)
            {
                // TODO: set visible before active
                if (b)
                {
                    setVisible(true);
                }
                mActive = b;
            }

            void activate()
            {
                setActive(true);
            }

            void deactivate()
            {
                setActive(false);
            }

            bool isActive() const
            {
                return (mActive && isVisible());
            }

            virtual ~RenderableObject()
            {
            }

        protected:
            bool mEnable;
            bool mVisible;
            bool mActive;
    };
}

#endif
